import request from '@/utils/request'

// 查看所有客户列表
export function getClientsListPage(page) {
  return request({
    url: '/customer/all',
    method: 'post',
    data: {
      page: page.page,
      count: page.count
    }
  })
}

// 查看联系人信息
export function getContact(id) {
  return request({
    url: '/customer/contact',
    method: 'post',
    data: id
  })
}

// 查看客户详情
export function getCustomer(id) {
  console.log(id)
  return request({
    url: '/customer/customer',
    method: 'post',
    data: id
  })
}

// 搜索客户
export function getListPage(data) {
  return request({
    url: '/customer/list',
    method: 'post',
    data: {
      username: data.username,
      page: data.page
    }
  })
}

// 删除某个客户
export function removeClient(id) {
  return request({
    url: '/customer/remove',
    method: 'post',
    data: id
  })
}

// 批量删除客户
export function batchRemoveClients(data) {
  console.log(data)
  return request({
    url: '/customer/remove',
    method: 'post',
    data: data
  })
}

// 编辑客户
export function editClient(data) {
  return request({
    url: '/customer/edit',
    method: 'post',
    data: data
  })
}

// 新增客户
export function addClient(data) {
  console.log(data)
  return request({
    url: '/customer/add',
    method: 'post',
    data: data
  })
}

// 选择下拉框显示字段名
export function getOption() {
  return request({
    url: '/customer/type',
    method: 'post'
  })
}

// 选择下拉框显示字段名
export function getOption1() {
  return request({
    url: '/customer/position',
    method: 'post'
  })
}
